home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / vbasic / gticon.zip / GTICON.FRM < prev    next >
Text File  |  1993-11-06  |  6KB  |  195 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "GT Icon DLL"
  5.    ClientHeight    =   3915
  6.    ClientLeft      =   3795
  7.    ClientTop       =   2340
  8.    ClientWidth     =   4005
  9.    Height          =   4320
  10.    Left            =   3735
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   261
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   267
  17.    Top             =   1995
  18.    Width           =   4125
  19.    Begin CommandButton cmd 
  20.       Cancel          =   -1  'True
  21.       Caption         =   "Quit"
  22.       Height          =   375
  23.       Index           =   1
  24.       Left            =   180
  25.       TabIndex        =   1
  26.       Top             =   2205
  27.       Width           =   3660
  28.    End
  29.    Begin PictureBox pic 
  30.       AutoRedraw      =   -1  'True
  31.       AutoSize        =   -1  'True
  32.       DragIcon        =   GTICON.FRX:0000
  33.       DragMode        =   1  'Automatic
  34.       Height          =   480
  35.       Left            =   630
  36.       ScaleHeight     =   30
  37.       ScaleMode       =   3  'Pixel
  38.       ScaleWidth      =   30
  39.       TabIndex        =   2
  40.       TabStop         =   0   'False
  41.       Top             =   675
  42.       Width           =   480
  43.    End
  44.    Begin CommandButton cmd 
  45.       Caption         =   "Go"
  46.       Default         =   -1  'True
  47.       Height          =   375
  48.       Index           =   0
  49.       Left            =   180
  50.       TabIndex        =   0
  51.       Top             =   1740
  52.       Width           =   3660
  53.    End
  54.    Begin Label lbl 
  55.       Alignment       =   2  'Center
  56.       AutoSize        =   -1  'True
  57.       Caption         =   "Drag the boxes below (Before)"
  58.       FontBold        =   0   'False
  59.       FontItalic      =   0   'False
  60.       FontName        =   "MS Sans Serif"
  61.       FontSize        =   9.75
  62.       FontStrikethru  =   0   'False
  63.       FontUnderline   =   0   'False
  64.       Height          =   240
  65.       Index           =   3
  66.       Left            =   -30
  67.       TabIndex        =   6
  68.       Top             =   135
  69.       Width           =   4005
  70.    End
  71.    Begin Label lbl 
  72.       AutoSize        =   -1  'True
  73.       Caption         =   "AssignDragIcon"
  74.       FontBold        =   0   'False
  75.       FontItalic      =   0   'False
  76.       FontName        =   "MS Sans Serif"
  77.       FontSize        =   9.75
  78.       FontStrikethru  =   0   'False
  79.       FontUnderline   =   0   'False
  80.       Height          =   240
  81.       Index           =   2
  82.       Left            =   2235
  83.       TabIndex        =   5
  84.       Top             =   1230
  85.       Width           =   1440
  86.    End
  87.    Begin Label lbl 
  88.       AutoSize        =   -1  'True
  89.       Caption         =   "GetDragIcon"
  90.       FontBold        =   0   'False
  91.       FontItalic      =   0   'False
  92.       FontName        =   "MS Sans Serif"
  93.       FontSize        =   9.75
  94.       FontStrikethru  =   0   'False
  95.       FontUnderline   =   0   'False
  96.       Height          =   240
  97.       Index           =   1
  98.       Left            =   330
  99.       TabIndex        =   4
  100.       Top             =   1230
  101.       Width           =   1140
  102.    End
  103.    Begin Label lbl 
  104.       Alignment       =   2  'Center
  105.       Caption         =   "This program illustrates the use of GTICON.DLL.  Copyright (c) 1993 George R. Torralba"
  106.       FontBold        =   0   'False
  107.       FontItalic      =   0   'False
  108.       FontName        =   "MS Sans Serif"
  109.       FontSize        =   9.75
  110.       FontStrikethru  =   0   'False
  111.       FontUnderline   =   0   'False
  112.       Height          =   690
  113.       Index           =   0
  114.       Left            =   240
  115.       TabIndex        =   3
  116.       Top             =   2760
  117.       Width           =   3525
  118.    End
  119.    Begin Image Image1 
  120.       BorderStyle     =   1  'Fixed Single
  121.       DragMode        =   1  'Automatic
  122.       Height          =   480
  123.       Left            =   2655
  124.       Top             =   675
  125.       Width           =   480
  126.    End
  127. End
  128.  
  129.    ' VB Project showing the use of:
  130.    '
  131.    ' AssignDragIcon  - Assign a handle to an icon (hIcon) to DragIcon property
  132.    ' GetDragIcon     - Get DragIcon property and assign it to an icon handle (hIcon)
  133.    '
  134.    ' Copyright (c) 1993 George R. Torralba
  135.    '
  136.    DefInt A-Z
  137.  
  138.    Dim hInst As Integer
  139.  
  140.    Declare Function AssignDragIcon% Lib "gticon.dll" (ctrl As Control, ByVal hIcon%)
  141.    Declare Function GetDragIcon% Lib "gticon.dll" (ctrl As Control)
  142.  
  143.    Const GWW_HINSTANCE = (-6)
  144.    Declare Function GetWindowWord% Lib "User" (ByVal hWnd%, ByVal nIndex%)
  145.  
  146.    Declare Function ExtractIcon% Lib "shell.dll" (ByVal hisnt%, ByVal lpszExeName$, ByVal iIcon%)
  147.    Declare Function DrawIcon% Lib "User" (ByVal hDC%, ByVal x%, ByVal y%, ByVal hIcon%)
  148.    Declare Function DestroyIcon% Lib "User" (ByVal hIcon%)
  149.  
  150. Sub cmd_Click (Index As Integer)
  151.    
  152.    Dim iDum As Integer, sbuf As String, hIcon As Integer
  153.  
  154.    If Index = 1 Then
  155.       Unload Me
  156.       Exit Sub
  157.       End If
  158.  
  159.    sbuf = "gticon.ico"
  160.    hIcon = ExtractIcon(hInst, sbuf, 0)
  161.    If (hIcon = 0) Or (hIcon = 1) Then
  162.       Beep
  163.       Exit Sub
  164.       End If
  165.    
  166.    If (AssignDragIcon(Image1, hIcon)) Then
  167.       Image1.BorderStyle = 0
  168.       Image1 = Image1.DragIcon
  169.       End If
  170.    
  171.    
  172.    If hIcon <> 0 Then
  173.       iDum = DestroyIcon(hIcon)
  174.       End If
  175.  
  176.    hIcon = GetDragIcon(pic)
  177.    If hIcon = 0 Then
  178.       Exit Sub
  179.       End If
  180.  
  181.    pic.BorderStyle = 0
  182.    iDum = DrawIcon(pic.hDC, 0, 0, hIcon)
  183.    iDum = DestroyIcon(hIcon)
  184.    pic.Refresh
  185.  
  186.    lbl(3) = "Drag the boxes below (After)"
  187. End Sub
  188.  
  189. Sub Form_Load ()
  190.  
  191.    hInst = GetWindowWord(Me.hWnd, GWW_HINSTANCE)
  192.  
  193. End Sub
  194.  
  195.